package com.xiaoy.core.basic.organization.service;

import java.util.List;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import com.xiaoy.core.basic.security.entity.PartyRole;
import com.xiaoy.dao.DaoUtil;
import com.xiaoy.exception.SystemException;

@Service("partyRoleSerivce")
public class PartyRoleSerivce {

	protected Logger logger = LoggerFactory.getLogger(getClass());
	
	@Resource(name="daoUtil")
	private DaoUtil<PartyRole, Long>daoUtil;	
	
	public void saveOrUpdate(PartyRole partyRole) throws SystemException{
		try {
			daoUtil.saveOrUpdate(partyRole);
		}catch (Exception e) {
			logger.error("角色分配错误",e);
			throw new SystemException("角色分配错误");
		}
	}
	
	public void saveOrUpdates (List<PartyRole> partyRoles) {
		for (PartyRole pr : partyRoles) {
			saveOrUpdate(pr);
		}
	}
	
}
